package com.of.aop;

import com.of.vo.SysResult;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice //advice 通知!!!
//全局异常处理机制,只拦截Controller层
public class SystemException {
    //指定异常的类型进行拦截.
    @ExceptionHandler(RuntimeException.class)
    public SysResult exception(Exception e){
        e.printStackTrace();//控制台打印异常
        return SysResult.fail();//201
    }
}
